//存储
export function setCookie(key, value, seconds, path = '/') {
    //定义当前事件日期对象
    const date = new Date()
    //设置事件日期对象
    date.setTime(date.getTime() - 8 * 3600 * 1000 + seconds * 1000)
    document.cookie = `${key}=${value};expires=${date};path=${path}`
}
//设置
export function getCookie(key) {
    //获取所有的cookie
    let cookies = document.cookie
    //判断有没有获取到
    if(!cookies) {
        return
    } 
    //转成数组 -炸开
    cookies = cookies.split('; ')
    //遍历
    for(let a = 0; a < cookies.length; a++) {
        //把其中每一项都炸开
        let brr = cookies[a].split('=')
        //炸开之后判断下标0
        if(brr[0] === key) {
            return brr[1]
        }
    }
}
//删除
export function removeCookie(key, path = '/') {
    //调用setcookie
    setCookie(key, null, -1, path)
}